function getHostSuffix(){
    let suffix;
    let matcher = window.location.host.match(/^[^\.]+(\.[^\.]+)?\.pano\.video/);
    if (matcher) {
        suffix = `${matcher[1] || ''}.pano.video`;
    } else {
        suffix = '.dev.pano.video';
    }
    return suffix
    // return '.bts.pano.video'
}

export function getGslbLoginURL() {
    return `https://demo-app${getHostSuffix()}/app/login`;
}
export function getSdkAisleOrigin() {
    return `https://aisle${getHostSuffix()}`;
}

export function formatTime(remainSeconds){
    let remainTime = ''
    try{
        let seconds = parseInt(remainSeconds)
        if(seconds >=0 ){

            let remainHours = Math.floor(seconds/3600)
            remainHours = remainHours < 10? `0${remainHours}` : remainHours
            
            let remainMinutes = Math.floor((seconds%3600)/60)
            remainMinutes = remainMinutes < 10? `0${remainMinutes}` : remainMinutes

            let remainSeconds = (seconds%60)
            remainSeconds = remainSeconds < 10? `0${remainSeconds}` : remainSeconds

            
            remainTime = `${remainHours}:${remainMinutes}:${remainSeconds}`
        }
    } catch(e){
        // ignore
    }

    return remainTime
}